﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace GenBenEditor
{
    public class Tileset
    {
        public const uint width = 256;
        public const uint height = 256;
        public const uint tile_width = 16;
        public const uint tile_height = 16;

        public string path;
        public Bitmap bitmap;

        public Tileset(string path)
        {
            this.path = path;
            bitmap = TgaLoader.FromFile(path);
        }

        public Rectangle GetTileRect(uint tile)
        {
            uint x = tile % (width / tile_width);
            uint y = tile / (width / tile_width);

            return new Rectangle((int)(x * tile_width), (int)(y * tile_height),
                (int)tile_width, (int)tile_height);
        }
    }
}
